package reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Test2 {
    public static void main(String[] args) throws Exception {
        Class c=Class.forName("reflect.Person");
        Method[] methods=c.getMethods();
        Object o = c.newInstance();
        for(Method e : methods)
        {
            int permit=e.getModifiers();
            int count=e.getParameterCount();
            if(permit== Modifier.PUBLIC && count==0)
                e.invoke(o);
        }
    }
}
